﻿using Microsoft.SharePoint;

namespace SharePoint.Orm.Metal.Model {
	public class ListInfo {
		private readonly CodeGeneratorConfiguration _config;
		private readonly SPList _list;

		public ListInfo(CodeGeneratorConfiguration config, SPList list) {
			_config = config;
			_list = list;
			ClassName = config.NameRewriter.ToListName(list);
		}

		public string FileName {
			get { return ClassName + _config.ListFileNameSuffix + ".cs"; }
		}

		public string ClassName { get; set; }

		public string NamespaceName {
			get { return _config.ListNamespaceName; }
		}

		public string FullClassName {
			get { return NamespaceName + "." + ClassName; }
		}

		public string ListId {
			get { return _list.ID.ToString(); }
		}

		public string ListTitle {
			get { return _list.Title; }
		}

		public bool IsDocumentLibrary {
			get { return _list is SPDocumentLibrary; }
		}
	}
}
